﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BUSINESS_OBJECT;
namespace CRM.admin
{
    public partial class schedule : System.Web.UI.Page
    {
        SCHEDULEe schdle = new SCHEDULEe();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = schdle.GetRecords(-99, "", "", Convert.ToDateTime("1/1/1800"), false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                DataTable dt = schdle.GetRecords(Convert.ToInt64(e.CommandArgument.ToString()), " ", "",Convert.ToDateTime("1/1/1800"), false, " and ");
                schdle.SC_ID = Convert.ToInt64(dt.Rows[0]["SC_ID"].ToString());
                schdle.SC_TYPE = dt.Rows[0]["SC_TYPE"].ToString();
                schdle.SC_DESCRIPTION = dt.Rows[0]["SC_DESCRIPTION"].ToString();
                schdle.DATE =Convert.ToDateTime(dt.Rows[0]["DATE"].ToString());
                schdle.ISDELETED = true;
                schdle.SaveRecords();
                Response.Redirect("~/schedule.aspx");
            }
            }
    }
}
